using System;
using System.Collections.Generic;
using System.Text;
using System.Workflow.ComponentModel.Compiler;

namespace WorkflowManagement.Workflow.Activities
{
	internal sealed class ResponseRedirectActivityValidator: ActivityValidator
	{
        public ResponseRedirectActivityValidator()
        {
        }

        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ResponseRedirectActivity activity = obj as ResponseRedirectActivity;
            
            ValidationErrorCollection errors = new ValidationErrorCollection();            
            if (activity != null)
            {
                if (!Uri.IsWellFormedUriString(activity.TargetUrl, UriKind.RelativeOrAbsolute))
                    errors.Add(new ValidationError(Properties.Resources.ResponseRedirectActivityValidator_InvalidTargetUrl, 1, true, "TargetUrl"));
            }
            return errors;
        }
	}
}
